Fix build with gcc 4.6.

Only GCC >=4.7 with C++11 enabled does not need "class" in friend declarations.

Reviewed by: Thiago Lacerda