While this was not the case - it is increasingly happening - and even when you are doing your PhD the authorship will be agreed upon. The more agreements are set up at the beginning of the process the better the outcome - and the more the friendship or relationship with the co-authors will continue.