title: Simple Subquery with OuterRef
body: <p>I am trying to make a very simple <code>Subquery</code> that uses <code>OuterRef</code> (not for practical purposes, but just to get it working), but I keep running into the same error.</p>
  <p><code>posts/models.py</code> code</p>
  <pre><code>from django.db import models
  
  class Tag(models.Model):
      name = models.CharField(max_length=120)
      def __str__(self):
          return self.name
  
  class Post(models.Model):
      title = models.CharField(max_length=120)
      tags = models.ManyToManyField(Tag)
      def __str__(self):
          return self.title
  </code></pre>
  <p><code>manage.py shell</code> code</p>
  <pre><code>&gt;&gt;&gt; from django.db.models import OuterRef, Subquery
  &gt;&gt;&gt; from posts.models import Tag, Post
  &gt;&gt;&gt; tag1 = Tag.objects.create(name='tag1')
  &gt;&gt;&gt; post1 = Post.objects.create(title='post1')
  &gt;&gt;&gt; post1.tags.add(tag1)
  &gt;&gt;&gt; Tag.objects.filter(post=post1.pk)
  &lt;QuerySet [&lt;Tag: tag1&gt;]&gt;
  &gt;&gt;&gt; tags_list = Tag.objects.filter(post=OuterRef('pk'))
  &gt;&gt;&gt; Post.objects.annotate(count=Subquery(tags_list.count()))
  </code></pre>
  <p>The last two lines should give me number of tags for each Post object. And here I keep getting the same error:</p>
  <pre><code>ValueError: This queryset contains a reference to an outer query and may only be used in a subquery.
  </code></pre>