Example of Friend function cannot be invoked with the object – C++

The friend function cannot be invoked with the object as the friend function is not in the scope of that class.

friend function cannot be invoked using the object as it is not in the scope of that class
a friend function cannot be invoked using the object as it is not in the scope of that class

The program shows an error because the Friend function cannot be invoked with the object.

Correct program

 

Prof.Fazal Rehman Shamil (Available for Professional Discussions)
1. Message on Facebook page for discussions,
2. Video lectures on Youtube
3. Email is only for Advertisement/business enquiries.