Defining a function at its friend declaration of a class template means the definition will only be available once specializations of the class template are instantiated. If the signature of the function does not rely on a template parameter of the enclosing class template, the class template may only be instantiated exactly for one single specialization in each translation unit (implicitly inline, so different specializations in different translation units are fine, as long as the definition does not depend on the template parameter):
template<typename>
struct S {
friend void f() {}
};
S<int> si{}; // f() definition instantiated
S<char> sc{} // ODR-violation, [basic.def.odr]/1
In your example the friend declaration is different for each specialization of S, and you do not risk ODR, however at the point where you are asking for the address of the friend function, it is yet to be defined, as the class template has not yet been instantiated (for the S<256> specialization), and GCC correctly emits an undefined reference error.
This behaviour is quite well-known and can be (ab)used to circumvent private access rules via means of explicit instantiation definitions (and in C++20: explicit specialitions); see e.g.
https://dfrib.github.io/a-foliage-of-folly/.
BR
David