score:2
There's not much that can be said about this for transfer airports in general.
In order for you and your friend to enjoy coffee togheter, both of you needs to be physically present on the same side of the immigration checkpoints. Logically, there are two ways to achieve that:
You go in through immigration and meet up landside. Depending on your nationality and which country the airport is in, this may or may not require you to have a visa.
In general you can't expect "just being in transit" to make border guards more likely to let you through without a visa than "coming for a vacation" would -- once you're through they would have no practical way to hold you to what you claim your plans are anyway.
There are a few countries where being in transit can sometimes ease up on visa requirements -- for example, the UK has a "Transit Without Visa" scheme -- but even so, to make use of such schemes you would often be expected to show an itinerary that gives you a more serious need to enter the country to follow it, than just "meeting a friend".
Your friend comes out through immigration and meets you in the transit zone.
Here the trouble is not usually immigration as such, but the fact that at most airports your friend would then also need to pass through security checkpoints, which generally only let actual passengers through, after checking boarding passes.
Depending on the airport it may be possible to arrange a meeting airside if you contact the airport administration in advance and are ready to pour enough money into the project, but it's not a service one would assume that a random hub airport necessarily provides.
A simpler way to make this happen would be for the friend to buy a cheap ticket for a neighboring country, check in with no luggage, and then decide not to fly after they've met you. Make sure the neighboring country is one the friend can enter without visas (so he can check in at all), and that the cheap flight departs from the same terminal you will pass through. Depending on the airport layout it may or may not be simple for your friend to leave the departure area without flying, but there'll have to be some way, for people who miss their flights.