#include <iostream>
using namespace std;

struct foo{
	bool operator==(bool val) const {
		cout << "foo::operator== ";
		return false;
	}
	bool operator!()const{
		cout << "foo::operator!";
		return reinterpret_cast<intptr_t>(this)/sizeof(this) / 2 == 0;
	}
};

bool operator==(bool lhs,const foo &rhs){
	cout << "global operator==";
	return true;
}

foo Function(){
	return foo();
}

int main() {
	if(false == Function()){
		cout << "true" <<endl;
	}else{
		cout <<"false" << endl;
	}
	if(Function() == false){
		cout << "true" <<endl;
	}else{
		cout <<"false" << endl;
	}
	if(!Function()){
		cout << "true" <<endl;
	}else{
		cout <<"false" << endl;
	}
	return 0;
}