// { dg-do compile { target c++20 } } // { dg-additional-options "-fconcepts" } template class A { public: template requires (I > 0) friend int f1(const A&); template friend int f2(const A&) requires (I > 0); private: int x = 2; }; template requires (I > 0) int f1(const A& a) { return a.x; } template int f2(const A& a) requires (I > 0) { return a.x; } class B { public: template requires (I > 0) friend int f3(const B&); template friend int f4(const B&) requires (I > 0); private: int x = 2; }; template requires (I > 0) int f3(const B& a) { return a.x; } template int f4(const B& a) requires (I > 0) { return a.x; } int main() { A a; f1<2>(a); f2<2>(a); B b; f3<2>(b); f4<2>(b); return 0; }