#include #include using namespace std; /* struct NodeT; class ListT{ private: NodeT * head; } */ class Friend2; class Friend1 { friend Friend2; public: void UpdateFriend(Friend2 & buddy); void Spill() { cout << "My data is " << myData << endl; } private: string myData; }; class Friend2 { friend Friend1; public: void Spill() { cout << "My note says " << note << endl; } void MakeFriend(Friend1 & buddy) { buddy.myData = "I have a friend"; } private: string note; }; void Friend1::UpdateFriend(Friend2 & buddy) { buddy.note = "My Friend updated me"; } int main(){ Friend1 a; Friend2 b; cout << "Before " << endl; a.Spill(); b.Spill(); cout << endl; a.UpdateFriend(b); b.MakeFriend(a); cout << "After " << endl; a.Spill(); b.Spill(); return 0; }