My PhD advisor was reviewing a paper and wanted me to look at the math (it was complicated); he still got editorial permission first. I did look at it, and I found a simple problem (the paper's authors used a $log_2$ result as if it were a $log_{10}$ result and got a [beneficially] wrong answer).
I was 'raised' to never share anything about a paper under review, including the topic! Plus I have known an unethical professor that used an idea from peer review to write a very similar paper. So suppose the paper you are reviewing is rejected at this journal for some reason, but the author still should retain all rights to his idea. He may get it published elsewhere.
But by showing it around you have effectively published his idea behind his back in a way others can steal it. One of the people interested in this can write their own paper, and perhaps with better contacts, reputation or just better writing, get published and steal the credit from the original author.
That is not fair or ethical. Even telling somebody about the topic or the title could trigger interest in the problem that did not previously exist, along the lines of "Hm, that gives me an idea..." That leads to pre-emption also.
I think the only advantage you can ethically enjoy, as a reviewer, is that IF the paper is accepted and GOING to be published, you have a significant head start on following up based on any new insights in the paper; giving proper credit where credit is due.
You should never share what is supposed to be confidential without permission of the editor, not even with friends you trust -- because the friends they trust may not be people you can trust.