Sprinkle the eggplant slices on both sides with salt, spread them out on a tray and leave 30 minutes. Sponge dry with paper towels.
In a large frying pan, pour in olive oil to a depth of 1/4 inch and place over medium heat. Fry the eggplant slices, in batches, in the hot oil until golden and tender at the stem ends, turning once. about 10 minutes. Add more oil to the pan as needed. Remove and drain on paper towels Pour off any oil.
Preheat the oven to 450 degrees. In the same frying pan, warm 2 tablespoons of olive oil over low heat. Add onions and cook gently until softened, about ten minutes. Add garlic, tomatoes and salt to taste. Increase heat to high. Toss until moisture from tomatoes evaporates, about 15 minutes. Set aside.
In a mixing bowl break up ricotta cheese and eggs with a whisk. Add half of the Parmesan, the cream, salt and pepper to taste. Whisk to consistency of a pourable cream.
Line a 6-cup gratin dish with half the eggplant slices in a single layer, pressing them in place. Grind some pepper over them. Tear basil leaves into fragments and scatter over eggplant. Sprinkle lightly with half the remaining Parmesan and the spread over the tomato mixture. Arrange the remaining eggplant slices on top in a single layer, pressing firmly in place. If there are a few extra slices, press them on top. Pour over the cheese-egg mixture and smooth the top. Sprinkle with the remaining Parmesan.
Put into the oven, reduce the heat to 350 degrees and bake until the custard surface is swelled and golden with no depression in the middle, about 30 minutes. Serve hot.