Hi,

Implicit instantiations of class templates don't instantiate the definitions of functions within the class. I don't think that friend functions are an exception.

Cheers,
Lénárd

On 6 May 2022 09:46:11 BST, Yongwei Wu via Std-Discussion <std-discussion@lists.isocpp.org> wrote:
Sorry, I think I misunderstood your problem in my last email. It is not really about friends (though it can cause troubles), but the instantiation moment. David pinned it: the function would be available as long as you instantiate S::X<256>.
 
On Thu, 5 May 2022 at 17:28, Vladimir Grigoriev via Std-Discussion <std-discussion@lists.isocpp.org> wrote:
Try this code
 
 
If to write
 
inline X<256> operator+(const X<256>&, const X<256>&) noexcept;
 
then the error message is
 
<source>:24: undefined reference to `S::operator+(S::X<256u> const&, S::X<256u> const&)'