in c++ what is a friend class
Give an example of friend classes in C++ and an example of when you would use one. In C++, the friend keyword can be applied to either a function or a class. A friend function or friend class has access to the private members of the class in which the declaration occurs. There are programmers who think that this feature violates the principles of object oriented programming because it allows a class to operate on another classâs private members.