why a friend function? which variables are accessed from this?