#include using namespace std; // myFriendClass1.cpp //class within a class class CommonFriend; class Domian1 { friend class CommonFriend; private: int domnum1; public: void dom1_pubmethod() { cout<<"\n \t publicly do_something ";} protected: void dom1_protectedmethod() { cout<<"\n \t do_something after inritance ";} }; class CommonFriend { private: Domian1 dom1; public : void allinone() { dom1. domnum1 = 201; cout<<"\n dom1 pvt mem variable -- : "<< dom1. domnum1; cout<<"\n dom1 protected mem function ---: "; dom1. dom1_protectedmethod(); cout<<"\n dom1 public mem function: "; dom1. dom1_pubmethod(); } }; int main() { CommonFriend commonwealth; commonwealth.allinone(); return 0; }