friend specifier
From Cppreference
This section is incomplete Reason: needs cleanup |
[edit] Description
The friend keyword is used to grant access to class members from outside of the class. For example, suppose your class has private or protected members. You can access these members only from the same class or derived classes respectively. By using the friend keyword you grant access to the private and protected members of your class to the friend function or a friend class. Some of the more common uses of friend are the operator>> and operator<< functions and the swap function.
[edit] Example use
friend ostream& operator<<(ostream& out, const T& o); friend istream& operator>>(istream& in, T& o); friend swap(T& left, T& right);