There's no real content in the index.php. This page only loads the wordpress core which loads the theme etc.
So you can't and don't need to set the visibility here. WordPress takes care of the security with internal mechanisms.
Therefore you define a static homepage in settings/reading and then you can change the visibility for this and any other page that needs to be private or password protected.
If this is not good enough, I'd recommand to go with a membership plugin, like
Paid Membership Pro
Restrict Content Pro
(list is from a Google document by Chris Coyer from CSS-Tricks)