friends functions properly