by Ursula K. Le Guin
You liked the magical school setting and themes of friendship in Harry Potter, and this book is one of the progenitors of those elements. It follows a young wizard as he attends a school for magic and comes to terms with his powers, making friends (and enemies) along the way. While it's more introspective than Harry Potter, the themes of growing up and finding your place in the world are similarly powerful.