The member function which is preceded by a key word friend is known as friend function.
A friend function although not a member function has full access rights to be the presale members of the class.
Characteristics
- It is not in the scope of the class to which it has been declared as friend.
- Since it is not in the scope of the class it cannot be called by using object of that class. It can be invoked like a normal function without using any object.
- Unlike member function it cannot access the member names directly and has tu use the object name and dot membesive operator with each member name.
- It can be declared either in the public or the private port of the class without affecting its meaning.
- Usually it has the objects as argument.