add friend functions and type conversion