Happened to me and my son last week. We both backed out of minecraft and closed the game, then went back in. Took about two tries and then we got it to connect. Worked fine after that. Wish I had more details but that's all I have.
Ok, we found the solution for our Problem. Seems like the last time we played together some web based data failed to save correctly which then ultimately turned out to keep us from connecting to each other. (just a guess)
Solution for the problem:
1.) Go to the Switch Home Menu
2.) Go to the System Settings
3.) Scroll all the way down to "System"
4.) In systems u scroll all the way down to "Formatting Options".
5.) In Formatting Options u hit "Clear Cache"
Warning: Clearing the Cache also deletes all of your saved IDs and passwords (eshop, facebook etc.) Just keep that in mind