#include #include using namespace std; template class wrapper; template bool operator==(const wrapper& w1, const wrapper& w2); template class wrapper { T t; public: wrapper(const T& initial_t = T()): t(initial_t) {} #ifdef __GNUC__ friend bool operator==(const wrapper& w1, const wrapper& w2); #else friend bool operator==(const wrapper& w1, const wrapper& w2) { return w1.t == w2.t; } #endif }; #ifdef __GNUC__ template inline bool operator==(const wrapper& w1, const wrapper& w2) { return w1.t == w2.t; } #endif int main() { cout << boolalpha << (wrapper() == wrapper()) << "\n"; return EXIT_SUCCESS; }