(ISO C++, §7.1.2, §11.4) If you use the friend keyword in a declaration, it must be the first word in the declaration. The virtual keyword does not have to be the first word in a declaration. An example using the virtual or friend Keywords:
class foo {
virtual int f0(); // OK
int virtual f1(); // OK
friend int f2(); // OK
int friend f3(); // ERROR
};