Suppose that $A\subseteq \mathbb{N}$ and suppose that you have an estimate of the form
$$
\sum\_{\substack{a\le x \\ a\in A}}f(a) \sim g(x).
$$
With this information is it possible to get an asymptotic estimate for $\sum\_{\substack{ab\le x \\ a,b\in A}}f(a)f(b)$? I would appreciate any reference in this kind of problem.

For example if $A$ is the set of prime numbers and $f(a)=1$, then we know that
$$
\sum\_{p\le x} 1 =\pi(x)\sim \frac{x}{\log{x}}.
$$
Now,
$$
\sum\_{pq\le x}1=\pi\_2(x)=\sum\_{j=1}^{\pi(x^{1/2})}\left[\pi\left(\frac{x}{p\_j}\right)-j+1\right]
$$
so that (after some calculations)
$$
\sum\_{pq\le x} 1 =\pi\_2(x)\sim \frac{x\log{\log{x}}}{\log{x}}
$$
So I was wondering if it's possible to generalize without relying too much on properties about $A$. The case I'm currently interested is when $A$ is the set of fundamental discriminants. In this case, we know that
$$
\sum\_{\substack{|D|\le x \\ D\in A}} 1\sim \frac{x}{\zeta(2)} .
$$
With this information is it possible to get an estimate for $\sum\_{\substack{|D\_1D\_2|\le x \\ D\_1,D\_2 \in A}}1$?