added friend functions