updata friend function