Technical Discussion :: C++
Home > Technical Interview Q&A > C++ > Discussion
Amit Yadav
23 Feb, 2019 5:07 AM
As the name suggests, the function acts as a friend to a class. As a friend of a class, it can access its private and protected members. A friend function is not a member of the class. But it must be listed in the class definition.
Tanveer
23 Feb, 2019 5:07 AM
It’s possible to grant a non-member function access to the private members of a class by using the keyword friend. A friend function has access to all private and protected members of the class for which it is a friend.