The QR code should be recognized by most barcode scanner applications (i.e. Barcode Scanner by ZXing) and the NFC tag is formatted in the same way as Android does since it introduced its "Write to NFC tag" option in Lollipop. That means people running Android 5.0+ won't have to download any specific app to connect to the network after scanning the tag.
You can also send Wi-Fi configuration via Android Beam: while on a Wi-Fi network screen, tap your device to your friend's device and a pop-up will appear asking if they want to connect.
Android does not let apps read the saved Wi-Fi passwords, so you will need to enter them manually for each network you want to share. However, the passwords will automatically be retrieved if WiFiKeyShare is given root access.
This app is free software: the source code is at https://github.com/bparmentier/WiFiKeyShare.