friend class in C++
A friend class is a class that can access the private and protected members of other class in which it is declared as friend. It is sometimes useful to allow a particular class to access the private and protected members of other class. ``` #include <iostream> using namespace std; class A { private: int a; public: A():a(0) {} friend class B; // Friend Class }; class B { public: void showA(A& a){ cout << "A::a=" << a.a; } }; int main() { A a; B b; b.showA(a); } ```