With Google Inactive Account Manager you can nominate someone else to access your Google services if you have not used them for an extended period (the default is three months). Google will send a trusted person an email and also a mobile phone verification code, so they can then access your data. The primary purpose for this is for when you die, although Google is sensitive enough not to mention this. The technical term for this feature is a "Dead Man's Switch".
It would be a good idea if other service providers implemented a Dead Man's Switch. The providers of services such as Facebook and LinkedIn appear to be currently avoiding the issue. It would be best if the account user themselves can decide this, rather than leaving it for grief-stricken relatives to have to go through an extended bureaucratic process to convince the service provider to hand over access.
Also it does not make sense in most cases for social media accounts to simply disappear, just because the person they are about is dead. Some details should remain and it would be best if the person themselves decided that. Google's approach could be applied, with information still available, but the account publicly marked "inactive". It would then be left to the trusted person if they wish to change the status to "deceased", or to delete the account. There could be a powerful commercial incentive for social media companies to support such a feature as there are services which could be advertised to the family and friends of the deceased.