Fix some errors compiling with GCC: must have 'class' keyword after friend.