friend declaration compatible with both GCC and Clang