integrity of friend function