1 // PR c++/95888
2 // { dg-do compile { target c++17 } }
3 
4 template <typename T> class A {
5   A(int, int);
6   template <typename> friend class A;
7   friend T;
8 };
9 
10 template<typename U> struct B {
11   template<auto V> struct C {
beginB::C12     A<B> begin() { return {1, 0}; }
13   };
14   template<auto Z, int *P = nullptr>
15   C<Z> fn();
16 };
17 
18 int
main()19 main ()
20 {
21   B<int> b;
22   b.fn<1>().begin();
23 }
24