If class one has to access to private data members of class 2,then friend declration should be given in..
Class 1
Class 2 Main
Both Class 1 and Class 2
class Class1 {
...
};
class Class2 {
friend Class1; //Declare Class1 as a friend of this class
...
};
Now Class1 can access Class2's private and protected members.
It's up to a particular class's definition which other classes can access its private and protected members.