#include <iostream> using namespace std; class A { public: void display(){cout<<x<<endl;} int getX() {return x;} friend class B; private: int x; }; class B { public: void set(int i); void display() { a.display(); }; private: A a; }; void B::set(int i) { a.x=i; } int main() { cout << "Hello world!" << endl; B a; a.set(9699); a.display(); return 0; }