Even in the best of groups it can be possible for this problem to come up. Two people make characters that are supposed to excel in the same area, only one of the players is more vocal about playing into those situations then the other one. Shortly after the second player starts to feel redundant and not needed because whenever a situation comes up that their character could play in it gets snatched up by the other player. This can be especially problematic for the GM because on the one hand you likely won't want to punish a player for jumping onto a situation they can handle, but you also need to keep the other player's fun in mind as well.
Fortunately, or unfortunately as it may be, this is a problem that all parties involved are responsible for addressing.
For The Offending Player
One thing that is important to remember when playing a game is that the idea is for everyone in the group to be having fun, and that includes you. However, it also includes everyone else. This means that you may, at times, need to keep your fun in check for the fun of other people. If you and someone else in the group are built in a similar fashion it may be worth talking to them about how you'd like it to work. With combat it can be as simple as taking different kinds of combat or threats on, with stealth it can involve splitting up and taking out multiple objectives simultaneously, with magic it can be different types of magic so one person is more direct effect and the other is more subtle effect, and with social it can just be a breka down of different strata.
Now the idea with this is to not step on toes. However, that can be hard to spot since problems in your area of expertise are the kind of things you should be leaping for so for this I'm going to simply say be cautious and on occasion step back and see if anyone else steps forward. It can be really satisfying to see the different ways different characters approach things and handle the problem, and it can also make it clear if other people are looking to excel in your area.
For The GM
First off, good job noticing the issue - or having your player trust you enough to discuss the issue with you. Secondly, solving the problem on your end is a bit different and weird, but only because you can be a bit more direct about things. My recommendation would be to first start in game. Try to give the character some moments where they can shine as well. If you need to, separate the character to make them stand out and shine. If you have to separate the character though do not under any circumstances stop there. Use the solo scene to establish the relationship and then bring it into the group section where the character in question now has even more advantage.
If doing things in the game this way doesn't work then you have two options. One, you can try to isolate the "problem" player for some of the situations to give the other person more of a chance (this doesn't solve the problem, and can just reinforce the idea that the player having issues is the second for the area.) Two, you can bring the issue up with the player. Odds are they are not intentionally causing problems and don't realize what is going on. Let them know, ask them to maybe pull back a bit, and let them know that you're going to be giving the other person a chance.
For The Offended Player
Frankly, the situation sucks but there are things you can do. First and most importantly, try to be more pro-active as a player. This is universal advice though, and like most universal advice it is nigh impossible to act on. I mean, it is like telling a depressed person to "just cheer up" because if the solution was really that easy, well, there wouldn't be a problem now would there? Even still, attemptingto be more pro-active can still help. Look out for opportunities to establish yourself and jump on them. Be loud if you have to about what you are doing. If the group is sitting around, just do something. What should you do? Honestly: the first thing that comes to mind. If nothing is going on, and you think it'd be fun to have your character head out to 7-11 for some roller hot dogs, then just do it. Do it so everyone knows and let the GM know as well. Who knows, maybe you can build a scene off of it and have some fun.
When you've tried this, and if it doesn't work (why else would you be reading this paragraph?) it may be time to take the issue out of chracter. Now, you have two options here (technically, 3.) One, you can talk to the player you feel you are competing with for screen/relevancy time and address your concerns and see what can be done about it. Two, you can talk to the GM and see if they can help you with getting some more focus time. Three, you can talk to the group or other members of the group and see what is being perceived from an outside perspective. The fun with three is that if other players are aware you are trying to establish your character as a doer of X they will be more likely to try and help you accomplish X when it comes up.
When First Attempts Fail
Sadly, these attempts won't always succeed and that brings us to other issues. This can be complicated as well because technically no one is doing anything wrong, they're just playing the game. Still, you do have options. Further Out of Character discussion is always an option and can work well here. Especially if previous conversations have been had this can be a second and more frank discussion of "the problem is still going on and what can we do to solve it?"
Beyond that, my recommendation (if you're the GM) is to start enforcing the difference boundaries. Odds are there are different areas of the same focus that the characters are effective in, so start playing those up. If one person is a sneaky assassin fighter and the other a bruiser thug fighter, then put situations where one or the other is definitely a lot more favored. The same can be done for ranged versus melee combat. It can also be done with types of magic and spheres of influence. It can even be done with social circles and who will talk to whom just based on those social circles.
Now, when you play up these differences remember what you are doing. Try to keep this balanced so you're not out and out making one player feel useless (that isn't what you want, even if it may feel "fair" to give the other person exclusive dominance time.) But don't pull punches in establishing why one approach is not appropriate over the other.
The Area That Is Nigh Impossible
Even with all this there is one area where it can be nigh impossible to fix, and that is when both characters are made to excel in the same thing. Both players made archers, lawyers, doctors, mages, fighters, thieves, assassins, blacksmiths, whatever. In those cases there may not be much you can do aside from encourage the players to differentiate so that you can give them both moments to shine from that difference.