The SIM and the Handset are separate. If Orange supplied the phone then they will have subsidised it to encourage your friend to sign up on one of their accounts. Consequently if you want the code to unlock it Orange may want paying to cover that subsidy, unless they feel your friend has spent enough with them to cover it.
The SIM card can only be used with the service provider it connects to. If you no longer want to use the SIM you can sling it, but I'd suggest you ensure you have used up the credit first.
Few years ago eh ? The SIM has probably been removed from the Orange database by now then.
As for the handset, as it is locked to Orange it may be the simplest solution to take it to a shop or market stall who offer an unlocking service. It isn't expensive. £15 seems a bit over the top to me, but I've not paid for a handset to be unlocked for ages.
It may be worthwhile you trying Orange/T-Mobile first, since they are now both owned by the same company. Never know, there may be free/cheap transfer service, but I'd not hold my breath.