9.12. friend Functions and friend Classes
A friend function of a class is a non-member function that has the right to access the
public and non-
public class members. Standalone functions, entire classes or member functions of other classes may be declared to be friends of another class.
This section presents a mechanical example of how a
friend function works. In Chapter 10 we’ll show
friend functions that overload operators for use with class objects—as you’ll see, sometimes a member function cannot be used for certain overloaded operators.