A basis for subgroups of free groups