You can only access private members of Class1 if Class2 is a "friend" of Class1 (which kind of ruins encapsulation) or if the Class2 "inherits" from Class1.
You can find out about inheritance and friend classes in C++ with a google search, but I think you want something simpler.
If you set Class1 up with a function returnPrivateMember(), then Class2 can call that function to get the variable.
E.g.
Class Class1
{
public:
Class1( int input ) { privateInt = input; }
int returnPrivateInt() { return privateInt; } //access to copy of private member
private:
int privateInt; //private member
};
class Class2
{
public:
Class2(): myClass1( 6 ) //initializes private Class1 with a value of 6
{ privateDouble = myClass1.returnPrivateInt(); } //assigns privateDouble with value returned by Class1 function
double returnPrivateDouble() { return privateDouble; }
private:
Class1 myClass1;
double privateDouble;
};
With such return-a-private-member functions, you can make sure the data of the class is still protected, while allowing other code to "see" the variable.