forward declare friend function to prevent linkage conflicts