friend function in c++

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

  1.  It is not in the scope of the class to which it has been declared as friend.
  2. 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.
  3. 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.
  4. It can be declared either in the public or the private port of the class without affecting its meaning.
  5. Usually it has the objects as argument.