Given a class T and a function f:
if (f needs to be virtual)
{
f should be a member function of T;
}
else if ( (f is operator>>) or (f is operator<<) or
(f needs type conversions on its left-most argument) )
{
f should be a non-member function;
if (f needs access to non-public members of T)
{
f should be a friend of T;
}
}
else if (f can be implemented via T's public interface)
{
f should be a non-member function;
}
else
{
f should be a member function of T;
}