One of the features available on the Y-Comm menu is the Surprise Trade. Select a Pokémon from your Boxes that you’re willing to trade, and that’s it! A trading partner will automatically be found as you continue on your adventure!
These trades can be carried out with players from around the world if you’re using the internet. But with local communication, you can even get a trade from someone around you before you know what’s happening! Head out to lots of different places, and see if you can get a Surprise Trade! You won’t know what Pokémon you’ll get in exchange for your Pokémon until you actually receive it. If you’re lucky, you might end up with a rare Pokémon.
Membership in the Nintendo Switch Online (paid) service is required to participate in Link Trades and Link Battles using the internet. There’s no need to set up a membership for local communication use.