C++ concept with friend-like access
问题 Is it possible to make this code work as I'd like? I.e. to allow the concept to have access to a private member funcion? template <typename T> concept bool Writeable() { return requires (T x,std::ostream os) { { x.Write(os) } -> void }; } template <Writeable T> void Write(std::ostream &os,const T &x) { x.Write(os); } class TT { private: void Write(std::ostream &os) const { os << "foo"; } //friend concept bool Writeable<TT>(); friend void ::Write<TT>(std::ostream &,const TT &); }; Thanks 回答1: