#include<iostream>
using namespace std;
class A
{
public:
void Display(){cout<<x<<endl;}
int GetX(){return x;}
void Set(int i);
friend class B;
private:
int x;
};
class B
{
public:
int Set(int i);
private:
A a;
};
int B::Set(int i)
{
a.x=i;
return (a.x);
}
void main()
{
B b;
A c;
b.Set(2);
c.Display();
}