https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59256
--- Comment #16 from Jonathan Wakely <redi at gcc dot gnu.org> --- The std::format case looks like this: namespace x { inline namespace v { namespace detail { template<class> struct bar; } template<class Arg> auto make(Arg); template<class T> class detail::bar { bar() { } template<class Arg> friend auto x::make(Arg); }; template<class Arg> auto make(Arg) { detail::bar<Arg> b; return 1; } } } int main() { return x::make(1); }