WiFiKeyShare is an Android application that lets you generate QR codes or NFC tags containing a Wi-Fi configuration (including its password).
This app is free software and is distributed under the GPLv3 licese.
When you open the app, your saved Wi-Fi networks will be listed along with their corresponding security. The logo on the right tells you if the app has the password. If your device is not rooted, it will be asked the first time you select a network.
You can view or clear the saved password with a long-tap on a network.
Simply let your friends scan the QR code with their favorite barcode scanner (i.e. Barcode Scanner by ZXing) and they will be able to connect to the network.
Push the button, and scan an NFC tag to write the Wi-Fi configuration to it.
The tag will be natively supported by Android 5.0 and more, so your friends won’t have to download any specific app to connect to the network after scanning the tag. Devices running an older version of Android will have to install WiFiKeyShare for the tag to be supported.
Bonus tip: approach two devices back to back, and you will be able to share the password with Android Beam.