The pilot flying is the pilot manipulating the controls.
The safety pilot is the pilot who performs the required functions such as lookout, monitoring the pilot flying undert the hood and if necessary takes control of the aircraft should it be required eg pilot flying suffers disorientation or is about to fly into a hill.
The pilot in command is one of the above who accepts the responsibility for the safety of the flight.
Note that accepting responsibility for something and actually doing it are two totally separate things.
The pilot flying could be the pilot in command and by instructing you to perform the role of safety pilot and ensuring that you do it, has ensured the safety of the flight in that respect. If they get disorientated or you see the need for avoiding action and you take control, they are still the pilot in command and are still responsible for the safety of the aircraft. You are simply manipulating the controls as they requried to acheive safety.
Provided that the flight is in VMC then both pilots do not need an IMC or IR. If at any stage the flight is in IMC then both pilots need an IMC or IR.
Depending on the aircraft type and the view limiting device(s) used, there may be a requirement for an observer also.
Regards,
DFC