https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59480
--- Comment #14 from Paolo Carlini <paolo.carlini at oracle dot com> --- Another testcase that we want to accept: class Matrix; void rot90 (const Matrix& a, int k = 1) { } class Matrix { friend void rot90 (const Matrix&, int); }; void rot90 (const Matrix& a, int k); We handle the third occurrence of rot90 as-if the second occurrence in: class Matrix { friend void rot90 (const Matrix&, int k = 1) { } }; void rot90 (const Matrix& a, int k); and of course we would reject it with my first try.