Are the two classes different in any way ? Does the scope of definition matter ?
.
.
class CSquare {
private:
int side;
friend class CRectangle;
public:
void set_side (int a)
{side=a;}
};
.
.
class CSquare {
private:
int side;
public:
friend class CRectangle;
void set_side (int a)
{side=a;}
};