I was hoping to get a response back to my information requestion but don't want you to go without an answer.
Often when there is pain when a dog eliminates it is due to an anal gland issue or other issue in the rectal area. If it is when he urinates, then it might be due to a urinary tract infection or bladder stones or crystals.
The anal glands are 2 sacs on either side of the anus at about the 4' o'clock and 8 o'clock positions. Many smaller dogs have problems with the glands becoming full and becoming painful. This problem can usually be resolved by emptying out the glands. To empty them or express them, you will want to cover the area with a tissue and press your finger on the dog's anal glands with an upward motion. A foul smelling liquid should come out. If nothing comes out and your dog appears to be in pain, your friend should take him to the Vet. Your vet can do this easily, as he is experienced at it.
Excellent site on anal glands
A Perianal Adenoma is also a possibility. You can read about this here:
If the dog has ingested a foreign object, it might also cause discomfort as it moves through the dog's system leading do cries when eliminating.
I hope this information is helpful to you. If you would like any additional information or have more questions please don’t hesitate to press the reply to expert or continue conversation button so I can address any issues you still have . If you do find this helpful, please take this opportunity to rate my answer positively so I am compensated for my time.