When you encounter Jirachi at the end of the cave he'll wake up and battle you. After defeating him you can either recruit him to your party or decline. If you decline he'll ask you if you want to wish for something instead. If you have the Wishing Stone you can accept and wish for anything you want. After the wish he'll go back to sleep until another explorer meets him. It is known that a wishing stone only works forone person you can't wish for something in a group, you have to come alone.