K
Kelly Mandrake
Iv'e been reading tutorials and articles describeing operator
overloading as both member functions and friend functions. I don't
understand however the purpose of the friend on an operator when the
operator already has access to the private data of a class since it is
a member. So why add the keyword friend.
What I do understand is that declareing a class or function as a friend
alows the friend to access private data without accessors. And I
understand that operator overloading gives us the ability to implement
common operators such as + and = on our user defined class objects.
Can somebody explain to me why a friend operator is so special?
overloading as both member functions and friend functions. I don't
understand however the purpose of the friend on an operator when the
operator already has access to the private data of a class since it is
a member. So why add the keyword friend.
What I do understand is that declareing a class or function as a friend
alows the friend to access private data without accessors. And I
understand that operator overloading gives us the ability to implement
common operators such as + and = on our user defined class objects.
Can somebody explain to me why a friend operator is so special?