So, after reading some SO questions and answers, i still doesn\'t understand why use
friend bool operator==( BaseClass const &left, BaseClass const &righ
There's nothing wrong per se with the member function, but the free function is more generic. The member function is forced to have the left-hand side operand be of type BaseClass
or a child type, while the free function accepts any types that are implicitly convertible to BaseClass
, not just types that are part of the inheritance tree.