https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80521
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The first testcase produces:
<source>:41:8: error: 'ProducerAccess' is not a template
41 | struct ProducerAccess {
| ^~~~~~~~~~~~~~
<source>:14:16: note: previous declaration here
14 | friend class ProducerAccess;
| ^~~~~~~~~~~~~~
Which is exactly what you expect.
