#include <iostream>
struct Car
{
int horsepower;
friend bool operator == ( Car &lhs, Car &rhs ) ;
};
bool operator == ( Car &lhs, Car &rhs )
{
return lhs.horsepower == rhs.horsepower;
}
int main( int argc, char* argv[] )
{
Car a, b, c;
a.horsepower = 80;
b.horsepower = 135;
c.horsepower = a.horsepower;
if( a == b )
std::cout << "a and b same\n";
if( a == c )
std::cout << "a and c same\n";
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKc3RydWN0IENhcgp7CglpbnQgaG9yc2Vwb3dlcjsKCWZyaWVuZCBib29sIG9wZXJhdG9yID09ICggQ2FyICZsaHMsIENhciAmcmhzICkgOwp9OwoKYm9vbCBvcGVyYXRvciA9PSAoIENhciAmbGhzLCBDYXIgJnJocyApCnsKCXJldHVybiBsaHMuaG9yc2Vwb3dlciA9PSByaHMuaG9yc2Vwb3dlcjsKfQoKaW50IG1haW4oIGludCBhcmdjLCBjaGFyKiBhcmd2W10gKSAKewoJQ2FyIGEsIGIsIGM7CglhLmhvcnNlcG93ZXIgPSA4MDsKCWIuaG9yc2Vwb3dlciA9IDEzNTsKCWMuaG9yc2Vwb3dlciA9IGEuaG9yc2Vwb3dlcjsKCQoJaWYoIGEgPT0gYiApCgkgICBzdGQ6OmNvdXQgPDwgImEgYW5kIGIgc2FtZVxuIjsKCSAgIAoJaWYoIGEgPT0gYyApCgkJc3RkOjpjb3V0IDw8ICJhIGFuZCBjIHNhbWVcbiI7CgkJCglyZXR1cm4gMDsKfQ==