// PR c++/93807 // { dg-do compile { target c++11 } } // In C++17, we need the following declaration to treat operator== as // a template name. In C++20, this is handled by [temp.names]/2. #if __cplusplus <= 201703L template class Foo; template constexpr bool operator==(T lhs, const Foo& rhs); #endif template class Foo { public: constexpr Foo(T k) : mK(k) {} constexpr friend bool operator==(T lhs, const Foo& rhs); private: T mK; }; template constexpr bool operator==(T lhs, const Foo& rhs) { return lhs == rhs.mK; } int main () { return 1 == Foo(1) ? 0 : 1; }