Yes you can drive your friends car as long as you are a tourist here. Meaning if police check you in the road, you have legal right to drive in Qatar...no issues.

However in case of accidents, you could be in trouble, because the insurance policy is not valid for other countries. Usually there is separate insurance for tourists, that the rent a car posess. So usually tourists rent cars.

As long as you are safe drive, no issues. But an accident to you may be due to mistake of other person. To summarise your life is in others hands during driving.