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