It is in chapters 6 and 7 of Kate DiCamilla's Because of Winn-Dixie that Miss Franny block, the tiny old librarian in Naomi, Florida, makes friends with both Opal and Winn-Dixie and decides he is welcome to visit the library any time.
In Chapter 6, Opal brings Winn-Dixie with her to the library and teaches him to stand on his hind legs so he can see through the window to watch her as she picks out books, which keeps him from feeling lonely. When Miss Franny sees Winn-Dixie through the window, she mistakes him for a bear she once saw in the library long ago and grows terrified. Opal must comfort her and assure her that Winn-Dixie is just her dog, but she is also very curious about the story of the bear and asks to hear it. When Miss Franny says it is a long story, Opal says she likes long stories and asks permission to bring Winn-Dixie in to hear the story too since he'll get lonely if Opal is gone a long time. Before Miss Franny can reply, Opal brings him inside.
As soon as Opal brings him inside, Winn-Dixie "came in and lay down with a 'huummmppff' and a sigh right at Miss Franny's feet." When she pats him, he wags his tail and nuzzles her feet. In Chapter 7, he sits quietly through the whole story of the library being built when Florida was still rugged and wild, of the bear wandering into the library, and of the bear running off with the book War and Peace. Miss Franny ends her story by saying, "I imagine I'm the only one left from those days," and recalling that all of her friends from that time period are now dead.
Winn-Dixie, having been lonely himself, is very quick to recognize loneliness in others such as in Opal and in Miss Franny. As soon as he recognizes Miss Franny's loneliness, he raises his head and looks "back and forth between [Opal] and Miss Franny" to show he recognizes they share loneliness in common, and smiles at Miss Franny. As soon as he smiles at her, Opal suggests they can all three be friends. It's at this point that Miss Franny agrees to let Winn-Dixie into the library any time.