replace friends with static member functions