It will happen to all of us someday: We'll be gone, but our data will persist. Photo albums are a thing of the past, but your memories don't have to be.
Enough people have been locked out of a dead parents’ device that Apple and Google have now made it possible for you to grant posthumous access. Apple calls the program Digital Legacy. Your selected Legacy Contacts can present the access key you give them along with your death certificate to gain access to any data you have stored on iCloud.
Google takes a slightly less morbid approach. You can configure Inactive Account Manager so that if you ever don’t log in for three, six, 12, or 18 months, your chosen contacts will be emailed with a link to download all your data.
You can read more in an article by Harry Guinness published in the Wired web site at: https://www.wired.com/story/how-to-leave-photos-behind-when-you-die/.