A friend class in C++, can access the "private" and "protected" members of the class in which it is declared as a friend. On declaration of friend class all member function of the friend class become friend of the class in which the friend class was declared. Friend status is not inherited; every friendship has to be explicitly declared. Friend classes can help in improving Encapsulation if used wisely.
Read more about Friend Class: Declaration, Advantages of Using Friend Class, Two Classes Accessing Private Data To Each Other, Scope, Features, Friend and Encapsulation
Famous quotes containing the words friend and/or class:
“It may be said that the elegant Swanns simplicity was but another, more refined form of vanity and that, like other Israelites, my parents old friend could present, one by one, the succession of states through which had passed his race, from the most naive snobbishness to the worst coarseness to the finest politeness.”
—Marcel Proust (18711922)
“God of justice, save the people
From the clash of race and creed,
From the strife of class and faction,
Make our nation free indeed;”
—William Pierson Merrill (18671954)