A city of the first class may accept, in trust, gifts, devises, and bequests of money or property to set up and run free medical dispensaries for the poor of the city or the county in which the city is situated, and free public libraries for city or county residents.