How to edit object which was created by other user

Hello,

I want to done some weird functionality where i need to update object created by other user  more in brief, lets say i have an example where USER A has created object X now i want to update this object of USER-A  X by USER B.

I have tried to do it but it is not working. can anyone help me out in the same.

Thanks,

Miteshsc