I'm sorry to note that this is an IMPOSSIBILITY FOR MULTIPLE REASONS, but I'll stick to the major ones...
1) There are ABSOLUTELY NO GAMES with online multiplayer that are cross-platform generation -- As you mentioned, Pokémon... the 2/3DS only has the 6th & 7th Generations (as well as Gen 3.5), but the Switch will only have the 8th Generation that won't be directly compatible with previous generations.
For the Pokémon titles, they will only communicate with versions that are in the same generation & platform. The only possible exception is the Pokémon Bank on 3DS, which has tools to pull pokémon from the DS & 3DS games. While there's no word about a Switch release for this service, it's something that's bound to be addressed as the Pokémon Sword / Shield releases get closer.
Pokémon games tend to have tools to import pokémon from the previous generation into the current one (from 3rd Gen & 1.5th gen to 4th & 2.5th Gen, then to 5th Gen... before requiring the PokéBank to make the jump from 5th to 6th onward).
While there are some games that are available on both 3DS & Switch, they typically don't have online support. Minecraft is one of the few exceptions, but the New 3DS version is on a "Legacy" engine while the Switch is on the "Bedrock" engine... which cannot communicate with each other.
2) The Switch & 3DS run on SEPARATE ONLINE SERVICES -- The 3DS runs on the Nintendo Network, which operates freely to all users. The Switch runs on the Switch Online service (an enhancement of the Nintendo Network), which requires a subscription to utilize online multiplayer services (excluding "Free to Start" games, like Fortnight).
If you want to play with your friend locally or online, you'll either have to pick up a Switch OR they pick up a 2/3DS to get on the same playing field.