The default way to address opponents in courtroom, no matter whether barristers, solicitors or lay litigants, is "<title> <surname>" e.g. Mr Smith.
"Learned friend" is just an alternative to be "sprinkled in occasionally". The "learned" bit was originally intended to denote that the opponent is highly educated in law and qualified to be representing people before the court. "Friend" denotes that the opponent is a member of the same profession or, otherwise, is civilized, reasonable, polite and adequate person to speak to about the contentious matters at issue (as opposed to what the actual opposing party would likely have been).
That said, strictly speaking, "learned friend" is only suitable for lawyers to verbally address each other in courtroom. But this is not a rule that is expected to be strictly followed. Indeed, I, while being a self-represented lay party, was actually addressed "my learned friend" by the opposing lawyer. I don't know whether it was a very subtle taunt/sarcasm or genuine appreciation, but either way, there was no disapproval by the judge.