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:
“She is such a good friend that she would throw all her acquaintances into the water for the pleasure of fishing them out again.”
—Charles Maurice Talleyrand (17541838)
“There is a struggle between the Oriental and the Occidental in every nation; some who would be forever contemplating the sun, and some who are hastening toward the sunset. The former class says to the latter, When you have reached the sunset, you will be no nearer to the sun. To which the latter replies, But we so prolong the day.”
—Henry David Thoreau (18171862)