This seems like a genuine C++ issue, though am not sure why GCC allows this. The supplied patch resolves the issue by matching the template parameter lists between the traits header and friend declaration.