...
Just as you said friendly games are avenues coaches use to test their squad and give playing time to young players especially for the fact that friendly games doesn't have a specific number of substitution, you can substitute as many as you want within the 90 minutes frame. Cup games in its initial stages also brings this opportunity as most times during the preliminary stage lower division teams are fused with the first division teams. So cups brings that opportunity of fielding these young players with 3 or 4 experienced ones to play along side.
And yet every coach is aware that these test situations can't be compared to real high pressure situations in important games. I think young talents can give a first glimpse in those friendly matches, but they can really shine when they get their 10-20 minutes in serious games and then convince their coach. For strikers it's quite simple, if they score then that is the best proof they can produce in a game, for defenders and midfielders it is more complicated.
But this is why big clubs like Bayern have their youth academies. They know who should get a chance to train with the A team and who should get some playing time. But it's also about the coach himself. Some coaches are very well known for integrating younger talents into their experienced teams while other coaches prefer to take less risk and rather let those play who have proven themselves over a certain amount of time.
I remember when van Gaal was a Bayern coach who gave several young players his full trust. Muller was one of those and I think Schweinsteiger was another one.