You can breed your starter (either with a Pokemon of the same Egg group if it's female, or otherwise with a Ditto) to obtain Eggs that will hatch into the starter Pokemon, effectively giving you 'duplicates' to trade with others. This has been possible since Generation 2 (Gold, Silver, Crystal). So instead of simply restarting the game & trading away the other starters, you can breed them and trade with friends (assuming that you all chose different starters to one another!).
In the newer games however, you are able to trade online, and therefore aren't reliant on having friends that started with a different starter to you. In Sun/Moon, your online options include:
- Put up one of your duplicate starters (or really any Pokemon) for trade on the Global Trade System (GTS), and request one of the other starters for trade.
- Note that more highly sought after Pokemon will be more likely to get a response, and as 'Starter A' is about as rare as 'Starter B' it's more likely that someone will be willing to trade you this.
- Simply browse GTS for the starter that you want, and see what other people want in exchange.
- Wonder Trade a lot. With Wonder trade your chances might be slimmer to get the starters you want, but with them generally being more highly sought after it's more likely other people are hatching them and Wonder trading them away.
- Spend time in online Pokemon communities (especially those centered around trading). One thing that is now possible when compared to Generation 3 is trading directly over the internet, and a lot of organised Pokemon communities feature a dedicated trading scene. Reddit, Facebook or even here on Arqade, you might find someone willing to trade you a Starter.
Update: Now with the release of the Pokebank for Sun/Moon, you are able to deposit your starter Pokemon in the Bank, allowing you to restart the game and withdraw them again at a later stage (i.e. restart twice, depositing two starters, and then withdraw them again when you have your third starter).
All online trading facilities (GTS, Wonder Trade, and Link Trade i.e. Friend to Friend) are handled inside 'Festival Plaza' - accessible from the main menu. It is unlocked after most of the initial "tutorial/story" section is done (after you visit the Professor's house) - probably about 15-20 minutes into the start of a game.
It is also still possible to directly trade with a friend over the internet, this is accomplished by using the 'Link Trade' option, again a part of Festival Plaza. See my answer here which covers the whole process: How to I trade with friends over the internet in Pokemon Sun/Moon?