Код: Выделить всё
struct Equal
{
friend bool operator==(const Equal&, const Equal&);
};
struct Unequal
{
friend bool operator!=(const Unequal&, const Unequal&);
};
int main()
{
Equal{} == Equal{}; // OK
Equal{} != Equal{}; // OK
Unequal{} == Unequal{}; // Error
Unequal{} != Unequal{}; // OK
}
Подробнее здесь: https://stackoverflow.com/questions/797 ... a-operator
Мобильная версия