Class Template: Friends
In this lesson, we will learn about friends of class templates.
We'll cover the following
Friends of a class template have access to all members of the class template
A class or a class template can have a friendship three features: to class or class templates, to function or function templates, and to types.
Rules:
- The declaration of friends can be made in an arbitrary place in the class declaration.
- The access rights in the class have no influence.
- Friendship will not be inherited.
- Friendship is not transitive.
Note: A friend has unrestricted access to the members of the class.
Get hands-on with 1400+ tech skills courses.