People who lacked close friendships before the age of 17 were more likely to develop dementia in later life, according to a new study