class with friend functions and stuff