It appears that the rule changed between eras.
WotC
Forced switching effects will fail if either the Defending or Benched Pokémon is protected:
Q. Would Base Mewtwo’s “Barrier” attack prevent the effect portion of attacks such as Ninetales’ “Lure” (switch), Pidgeot’s “Hurricane” (back into hand), or Dragonair’s “Hyper Beam” (discard an energy card) from happening to Mewtwo?
A. Yes they would, it prevents ALL effects from an attack [that affect Mewtwo directly]. (Sep 21, 2000 WotC Chat, Q10)
Q. If I have a promo Mew [with Neutral Shield] on my bench and my opponent uses Rapid Spin, can I intentionally choose Mew so I don’t have to switch Pokemon?
A. Yes. (May 1, 2003 WotC Chat, Q1440)
(Also, I found out while testing that Ninetales BS’s Lure makes you choose a Pokémon twice. The second Pokémon chosen is switched in.)
EX
Forced switching effects will fail if either the Defending or Benched Pokémon is protected:
Q. Wobbuffet vs. Ninetales-EX… I try to use “Intense Glare” (switch 1 your opponent’s Benched Pokémon with 1 of the Defending Pokémon…) on Wobbuffet. Does Wobbuffet’s Safeguard Poké-BODY prevent the switch?
A. Yes it would prevent the switch. In addition, you could not do Intense Glare to bring up a Wobbuffet from the bench either, as that would be an “effect being done to Wobbuffet by a Pokémon-EX.” (Feb 24, 2005 PUI Rules Team)
(Here is another ruling, confirming that if only the Defending is protected, the switch will fail:)
Q. For Unown-E’s “Hidden Power”, if the defending Pokémon has a Holon Energy WP and a Water Energy attached, how much of the attack can I do? I’m pretty certain I cannot perform the switching part, but can I put the Pokémon down from the opponent’s hand or not?
A. Yes you can. You would put the basic onto the bench, but Holon Energy WP would prevent the switching part of the attack. (Jun 1, 2006 PUI Rules Team)
DP onwards
It depends on whether you choose the Benched Pokémon (gust), or your opponent chooses (repel).
If the effect is a gust, it will fail if the Benched, not the Defending, has protection:
Q. If my opponent’s Active Pokemon has the “Omega Barrier” Ancient Trait, can I use Lysandre to switch one of my benched Pokemon with it?
A. If your opponent’s Benched Pokemon has “Omega Barrier”, then Lysandre’s effect will be blocked. But choosing a Benched Pokemon without “Omega Barrier” will cause it to switch with the Active Pokemon because the Benched Pokemon is the target of Lysandre. (Apr 9, 2015 TPCi Rules Team)
If the effect is a repel, it will fail if the Defending, not the Benched, has protection:
Q. If I use Escape Rope but my opponent’s Active Pokemon has the “Omega Barrier” Ancient Trait does he or she have to switch it? Or if they have a Pokemon with “Omega Barrier” on the bench can he or she choose that and not switch it to Active?
A. If your opponent has an Active Pokemon with “Omega Barrier”, then Escape Rope’s effect will be blocked. If a Pokemon with “Omega Barrier” is on the bench, choosing that Pokemon will not stop the effect as the Active was the target of Escape Rope. (Primal Clash FAQ; Feb 5, 2015 TPCi Rules Team)
(Note: the above examples use Trainers and is from XY, but the rule is the same for attacks dating back to DP. Link to Japanese rulings: gust (Zangoose’s Invite and Strike), repel (Forretress’s Gyro Ball))